/* pages/diary/diary-model.js.wxss */
import { Base } from '../../utils/base.js';

class Diary extends Base {
  constructor() {
    super();
  }

  getDiaryList(callback) {
    var allParams = {
      url: 'pets_diary/list',
      type: 'get',
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParams);
  }

  getDiaryOneList(id, callback) {
    var allParams = {
      url: 'pets_diary/getlist?id=' + id,
      type: 'get',
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParams);
  }

  delDiary(id, callback) {
    var allParams = {
      url: 'pets_diary/del?id=' + id,
      type: 'get',
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParams);
  }

  createDiary(param, callback) {
    var allParam = {
      url: 'pets_diary/create',
      type: 'POST',
      data: param,
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParam);
  }

  getMyPets(callback) {
    var allParams = {
      url: 'pets/user',
      type: 'get',
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParams);
  }
  getDiary(id, callback) {
    var allParams = {
      url: 'pets_diary/info?id=' + id,
      type: 'get',
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParams);
  }

  updateDiary(id, param, callback) {
    var allParam = {
      url: 'pets_diary/update?id=' + id,
      type: 'POST',
      data: param,
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParam);
  }
}

export { Diary }